
interface IBaseConn<T>{
    url:string;
    list:T[];
    add(data:T):boolean;
    get():T[];
}

class Mysql<T> implements IBaseConn<T>{
    url:string;
    list:T[]=[];
    constructor(url:string){
        this.url=url;
        console.log("mysql connect success "+this.url);
    }
    add(data:T):boolean{
        this.list.push(data);
        return true;
    };
    get():T[]{
        return this.list;
    }
}

class User{
    name:string;
    age:number;
    constructor(name:string,age:number){
        this.name=name;
        this.age=age;
    }
}

var uu=new User("Tom",20);
var mysql=new Mysql<User>('www.baidu.com/db');
mysql.add(u);
console.log(mysql.get());